/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jjsoft.disco.gco.mdl;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Johnny
 */
@Entity
@Table(catalog = "discodb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Productobarra.findAll", query = "SELECT p FROM Productobarra p"),
    @NamedQuery(name = "Productobarra.findByIdproductoBarra", query = "SELECT p FROM Productobarra p WHERE p.idproductoBarra = :idproductoBarra"),
    @NamedQuery(name = "Productobarra.findByIdBarra", query = "SELECT p FROM Productobarra p WHERE p.idBarra = :idBarra"),
    @NamedQuery(name = "Productobarra.findByCantidad", query = "SELECT p FROM Productobarra p WHERE p.cantidad = :cantidad")})
public class Productobarra implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(nullable = false)
    private Integer idproductoBarra;
    private Integer idBarra;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(precision = 22)
    private Double cantidad;
    @JoinColumn(name = "idProducto", referencedColumnName = "idProductos")
    @ManyToOne
    private Producto idProducto;

    public Productobarra() {
    }

    public Productobarra(Integer idproductoBarra) {
        this.idproductoBarra = idproductoBarra;
    }

    public Integer getIdproductoBarra() {
        return idproductoBarra;
    }

    public void setIdproductoBarra(Integer idproductoBarra) {
        this.idproductoBarra = idproductoBarra;
    }

    public Integer getIdBarra() {
        return idBarra;
    }

    public void setIdBarra(Integer idBarra) {
        this.idBarra = idBarra;
    }

    public Double getCantidad() {
        return cantidad;
    }

    public void setCantidad(Double cantidad) {
        this.cantidad = cantidad;
    }

    public Producto getIdProducto() {
        return idProducto;
    }

    public void setIdProducto(Producto idProducto) {
        this.idProducto = idProducto;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idproductoBarra != null ? idproductoBarra.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Productobarra)) {
            return false;
        }
        Productobarra other = (Productobarra) object;
        if ((this.idproductoBarra == null && other.idproductoBarra != null) || (this.idproductoBarra != null && !this.idproductoBarra.equals(other.idproductoBarra))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jjsoft.disco.gco.mdl.Productobarra[ idproductoBarra=" + idproductoBarra + " ]";
    }
    
}
